#include "BattleModelUnits.hpp"
#include <iostream>

using namespace BWAPI;
using namespace std;

BattleModelUnit::BattleModelUnit(
	BWAPI::Unit *unit
)
{
	UnitType unitType = unit->getType();
}

BattleModelUnit::BattleModelUnit(
	const int location,
	const BWAPI::UnitType unitType,
	const std::string name,
	const BattleModelUnitController controller
)
:	m_name(name),
	m_cooldown(0),
	m_moveCooldown(0),
	m_controller(controller),
	m_location(location)
{
	m_speed = 10;//unitType.topSpeed();
	m_hp = 100;//unitType.maxHitPoints();
	m_capacityRequired = 1;
	
	WeaponType groundWeapon = unitType.groundWeapon();
	m_groundRange = groundWeapon.maxRange();
	m_groundCooldown = groundWeapon.damageCooldown();
}

void BattleModelUnit::print() const
{
	cout<<m_name<<"("<<m_hp<<","<<m_cooldown<<","<<m_moveCooldown<<")";
}

void BattleModelUnit::onFrame()
{
	m_moveCooldown--;
	m_cooldown--;
	if (m_controller==BattleModelUnitController::Player) {
		tryToMove(-1);
	} else {
		tryToMove(1);
	}
}

void BattleModelUnit::tryToMove(
	const int direction
)
{
	if (m_moveCooldown>0) {
		return;
	}
	if 

}

/*StandardBattleModelUnit::StandardBattleModelUnit(
	const int location,
	const BWAPI::UnitType unitType,
	const std::string name,
	const BattleModelUnitController controller
)
:	BattleModelUnit(location, unitType, name, controller)
{
}*/
